using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AddressBook
{
    public partial class MainForm : Form
    {
        private ListViewCRUD lvc;
        public MainForm()
        {
            InitializeComponent();
            lvc = new ListViewCRUD(listView1, Program.session.All<Item>());
            lvc.FormType = typeof (ItemForm);
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Rocker Up
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Rocker Down
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
            }

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            lvc.New(Program.session.Create<Item>());
        }

        private void menuItem3_Click(object sender, EventArgs e)
        {
            lvc.Delete();
        }

        private void menuItem4_Click(object sender, EventArgs e)
        {
            lvc.Edit();
        }

        private void menuItem5_Click(object sender, EventArgs e)
        {
            Program.session.Save();
            MessageBox.Show("Data saved.");
        }
    }
}